package udp;

import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;

public class 发送端 {
    public static void main(String[] args) throws Exception{
        //准备数据
        byte[] data = "你不配".getBytes();
        //打包数据
        DatagramPacket packet = new DatagramPacket(data, data.length, InetAddress.getByName("192.168.15.69"), 1024);
        //创建socket对象
        DatagramSocket socket = new DatagramSocket();
        //发送数据
        socket.send(packet);
        //释放资源
        socket.close();
    }
}
